package com.dragon.modules.yuegou.enums.wallet;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 审核状态
 * 
 * @author pbuilder generated
 *
 */
public enum EntityCardCheckStatus {

	/**
	 * 未付款
	 */
	UNPAY(0, "未付款"),
	/**
	 * 审核中
	 */
	CHECKING(1, "审核中"),
	/**
	 * 已完成
	 */
	SUCCESSED(2, "已完成"),
	/**
	 * 已驳回
	 */
	REJECTED(3, "已驳回"),
	/**
	 * 待收货
	 */
	WAIT_RECEIVING(4, "待收货"),
	/**
	 * 待激活
	 */
	ACTIVATE(5, "待激活"),
	/**
	 * 废弃
	 */
	ABANDONED(6, "废弃");

	/**
	 * 枚举标识
	 */
	private final Integer code;

	/**
	 * 别名
	 */
	private final String alias;

	private EntityCardCheckStatus(Integer code, String alias) {
		this.code = code;
		this.alias = alias;
	}
	
	public Integer getValue() {
		return code;
	}

	/**
	 * 枚举标识
	 * 
	 * @return code
	 */
	public Integer getCode() {
		return code;
	}

	/**
	 * 别名
	 * 
	 * @return alias
	 */
	public String getAlias() {
		return alias;
	}

	/**
	 * 把code转化为费用类型枚举
	 * 
	 * @param code 代码
	 * @return
	 */
	@JsonCreator
	public static EntityCardCheckStatus from(Integer code) {
		if (code == null) {
			return null;
		}
		return CODE_MAP.get(code);
	}

	/**
	 * Code Map for EntityCardCheckStatus
	 */
	private static final Map<Integer, EntityCardCheckStatus> CODE_MAP = Stream.of(EntityCardCheckStatus.values())
			.collect(Collectors.toMap(EntityCardCheckStatus::getCode, e -> e));

}
